package com.chance.cc.crawler.prod.command.job.domain.news.baidu;

import com.chance.cc.crawler.core.downloader.proxy.Proxy;
import com.chance.cc.crawler.core.record.CrawlerRequestRecord;
import com.chance.cc.crawler.prod.command.job.CrawlerJobCommand;
import org.apache.commons.lang3.StringUtils;

import static com.chance.cc.crawler.core.CrawlerEnum.CrawlerRequestType.*;

/**
 * @author lt
 * @version 1.0
 * @date 2021-04-10 10:43:24
 * @email okprog@sina.com
 */
public class BaiDuCommonScript {
    public static final String domain = "baidu";
    public static final String site = "tieba";
    public static final String kwSite = "search_keyword";
    public static final String TieBaKwSite = "tieba_keyword";
    public static final String ZhiDaoKwSite = "zhidao_keyword";

    public static final String SEARCH_POST_BAR = "search_post_bar";
    public static final String SEARCH_POST_TOPIC = "search_post_topic";
    public static final String SEARCH_POST_TOPIC_MODEL = "search_post_topic_model";
    public static final String MODEL_REPLY = "model_reply";
    public static final String MODEL_publish = "model_publish";


    public static Proxy proxy = new Proxy();
    static {
        //代理配置
        //HL89Q19E86E2987D
        //71F33D94CE5F7BF2
        proxy.setHost("http-dyn.abuyun.com");
        proxy.setPort(9020);
        proxy.setUsername("HL89Q19E86E2987D");
        proxy.setPassword("71F33D94CE5F7BF2");
    }

    public static final String metaServiceIp = "192.168.1.217";
    public static final int metaServicePort = 9599;
    public static final String metaServiceHttpPrefix = "http://"+metaServiceIp+":"+metaServicePort;

    public static final String kafkaTopicForRealTimeJob = "news";
    public static final String kafkaTopicForTraceJob = "news";

    public static CrawlerJobCommand metaServiceCommand = new CrawlerJobCommand(metaServiceIp,metaServicePort);

    public static CrawlerRequestRecord getKwRecord(String metaSite){
        //keyword record
        return CrawlerRequestRecord.builder()
                .startPageRequest(StringUtils.joinWith("-",domain, site),turnPageItem)
                .httpUrl("http://192.168.1.217:9599/v1/meta/"+domain+"/keys?site=" + metaSite)
                .requestLabelTag(supportSource)
                .requestLabelTag(internalDownload)
                .build();
    }
}
